<script setup>
import { defineProps } from 'vue';
const value2 = defineProps({
  value1:{
    type: Number,
    required: true
  }
})

function reNav(e){
  let url='/pages/index/index'

  switch (e){
    case 0:
      url='/pages/index/index';
      break;
    case 1:
      url='/classification/index/index';
      break;
    case 2:
      url='/shopCar/index/index';
      break;
    case 3:
      url='/myuser/index/index';
      break;
  }
  uni.redirectTo({
    url: url
  });
}
</script>

<template>
<view class="tapbar">
  <up-tabbar
      :value="value2.value1"
      :fixed="false"
      :placeholder="false"
      :safeAreaInsetBottom="false"
      @change="reNav"
  >
    <up-tabbar-item text="首页" icon="home"></up-tabbar-item>
    <up-tabbar-item text="分类" icon="photo"></up-tabbar-item>
    <up-tabbar-item text="购物车" icon="play-right"></up-tabbar-item>
    <up-tabbar-item text="我的" icon="account"></up-tabbar-item>
  </up-tabbar>
</view>
</template>

<style scoped lang="scss">
.tapbar{
  width:100vw;
  position:fixed;
  bottom:0;
  left:0;
  z-index: 99;
}
</style>